﻿<UserControl xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk"  x:Class="TimeSheet.UI.Views.WeekControl"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d"
    SizeChanged="UserControl_SizeChanged"
    d:DesignHeight="168" d:DesignWidth="813">
    
    <Grid DataContext="{Binding .}">
        <StackPanel Name="panHeader" Orientation="Horizontal" Height="32" VerticalAlignment="Top">
            <StackPanel.Resources>
                <Style TargetType="TextBlock">
                    <Setter Property="Width" Value="70" />
                    <Setter Property="FontWeight" Value="Bold" />
                    <Setter Property="TextAlignment" Value="Center" />
                    <Setter Property="VerticalAlignment" Value="Center" />
                </Style>
            </StackPanel.Resources>

            <TextBlock Name="lblProjects" Text="Projects" />
            
            <StackPanel Orientation="Vertical">
                <StackPanel Orientation="Horizontal">
                    <TextBlock Text="{Binding Path=DayLabel.MondayName}" />
                    <TextBlock Text="{Binding Path=DayLabel.TuesdayName}" />
                    <TextBlock Text="{Binding Path=DayLabel.WednesdayName}" />
                    <TextBlock Text="{Binding Path=DayLabel.ThursdayName}" />
                    <TextBlock Text="{Binding Path=DayLabel.FridayName}" />
                    <TextBlock Text="{Binding Path=DayLabel.SaturdayName}" Foreground="Gray" />
                    <TextBlock Text="{Binding Path=DayLabel.SundayName}"   Foreground="Gray" />
                </StackPanel>
                <StackPanel Orientation="Horizontal">
                    <TextBlock Text="{Binding Path=DayLabel.Monday}"    FontWeight="Normal" />
                    <TextBlock Text="{Binding Path=DayLabel.Tuesday}"   FontWeight="Normal" />
                    <TextBlock Text="{Binding Path=DayLabel.Wednesday}" FontWeight="Normal" />
                    <TextBlock Text="{Binding Path=DayLabel.Thursday}"  FontWeight="Normal" />
                    <TextBlock Text="{Binding Path=DayLabel.Friday}"    FontWeight="Normal" />
                    <TextBlock Text="{Binding Path=DayLabel.Saturday}"  FontWeight="Normal" Foreground="Gray"  />
                    <TextBlock Text="{Binding Path=DayLabel.Sunday}"    FontWeight="Normal" Foreground="Gray"  />
                </StackPanel>
            </StackPanel>
        </StackPanel>

        <ListBox Margin="0,38,0,32" ItemsSource="{Binding Path=Projects}" ScrollViewer.VerticalScrollBarVisibility="Visible">
            <ListBox.ItemTemplate>
                <DataTemplate>
                    <StackPanel Orientation="Horizontal">
                        <StackPanel.Resources>
                            <Style TargetType="TextBox">
                                <Setter Property="Width" Value="60" />
                                <Setter Property="Margin" Value="5,0,5,0" />
                            </Style>
                        </StackPanel.Resources>
                        
                        <sdk:AutoCompleteBox Width="{Binding Path=Width}" Text="{Binding Path=Project}"                                              
                                             MinimumPrefixLength="0"
                                             MinWidth="0"
                                             Populating="AutoCompleteBox_Populating"  
                                             KeyDown="AutoCompleteBox_KeyDown"                                             
                                             FilterMode="Contains" 
                                             IsTextCompletionEnabled="True">
                            <sdk:AutoCompleteBox.Resources>
                                <Style TargetType="ScrollViewer">
                                    <Setter Property="HorizontalScrollBarVisibility" Value="Hidden" />                                    
                                </Style>
                            </sdk:AutoCompleteBox.Resources>
                            <sdk:AutoCompleteBox.ItemTemplate>
                                <DataTemplate>
                                    <StackPanel Orientation="Horizontal">
                                        <TextBlock Text="Project: " />
                                        <TextBlock Text="{Binding .}" />    
                                    </StackPanel>                                    
                                </DataTemplate>
                            </sdk:AutoCompleteBox.ItemTemplate>
                        </sdk:AutoCompleteBox>
                        <TextBox Text="{Binding Path=Monday, Mode=TwoWay}" GotFocus="TextBox_GotFocus" />
                        <TextBox Text="{Binding Path=Tuesday, Mode=TwoWay}" GotFocus="TextBox_GotFocus" />
                        <TextBox Text="{Binding Path=Wednesday, Mode=TwoWay}" GotFocus="TextBox_GotFocus" />
                        <TextBox Text="{Binding Path=Thursday, Mode=TwoWay}" GotFocus="TextBox_GotFocus" />
                        <TextBox Text="{Binding Path=Friday, Mode=TwoWay}" GotFocus="TextBox_GotFocus" />
                        <TextBox Text="{Binding Path=Saturday, Mode=TwoWay}" GotFocus="TextBox_GotFocus" />
                        <TextBox Text="{Binding Path=Sunday, Mode=TwoWay}" GotFocus="TextBox_GotFocus" />
                    </StackPanel>
                </DataTemplate>
            </ListBox.ItemTemplate>
        </ListBox>

        <StackPanel Name="panFooter" Orientation="Horizontal" Height="32" VerticalAlignment="Bottom">
            <StackPanel.Resources>
                <Style TargetType="TextBlock">
                    <Setter Property="Width" Value="70" />                    
                    <Setter Property="TextAlignment" Value="Center" />
                    <Setter Property="VerticalAlignment" Value="Center" />
                </Style>
            </StackPanel.Resources>

            <TextBlock Name="lblTotal" Text="Total days" TextAlignment="Right" FontWeight="Bold" />

            <TextBlock Text="{Binding Path=DayFooter.TotalMonday}" />
            <TextBlock Text="{Binding Path=DayFooter.TotalTuesday}" />
            <TextBlock Text="{Binding Path=DayFooter.TotalWednesday}" />
            <TextBlock Text="{Binding Path=DayFooter.TotalThursday}" />
            <TextBlock Text="{Binding Path=DayFooter.TotalFriday}" />
            <TextBlock Text="{Binding Path=DayFooter.TotalSaturday}" Foreground="Gray" />
            <TextBlock Text="{Binding Path=DayFooter.TotalSunday}"   Foreground="Gray" />
            
        </StackPanel>
        
    </Grid>
</UserControl>
